package handling.world;

import client.MapleCoolDownValueHolder;
import client.MapleDiseaseValueHolder;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PlayerBuffStorage implements Serializable {
    private static Map<Integer, List<PlayerBuffValueHolder>> buffs;
    private static Map<Integer, List<MapleCoolDownValueHolder>> coolDowns;
    private static Map<Integer, List<MapleDiseaseValueHolder>> diseases;

    public static void addBuffsToStorage(int chrid, List<PlayerBuffValueHolder> toStore) {
        PlayerBuffStorage.buffs.put(Integer.valueOf(chrid), toStore);
    }

    public static void addCooldownsToStorage(int chrid, List<MapleCoolDownValueHolder> toStore) {
        PlayerBuffStorage.coolDowns.put(Integer.valueOf(chrid), toStore);
    }

    public static void addDiseaseToStorage(int chrid, List<MapleDiseaseValueHolder> toStore) {
        PlayerBuffStorage.diseases.put(Integer.valueOf(chrid), toStore);
    }

    public static List<PlayerBuffValueHolder> getBuffsFromStorage(int chrid) {
        return PlayerBuffStorage.buffs.remove(Integer.valueOf(chrid));
    }

    public static List<MapleCoolDownValueHolder> getCooldownsFromStorage(int chrid) {
        return PlayerBuffStorage.coolDowns.remove(Integer.valueOf(chrid));
    }

    public static List<MapleDiseaseValueHolder> getDiseaseFromStorage(int chrid) {
        return PlayerBuffStorage.diseases.remove(Integer.valueOf(chrid));
    }

    static {
        buffs = new ConcurrentHashMap();
        coolDowns = new ConcurrentHashMap();
        diseases = new ConcurrentHashMap();
    }
}
